package com.tzf.msst.model.vo;

import com.tzf.msst.model.entity.UserCommentQst;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 用户评论视图
 */
@Data
public class UserCommentQstVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 内容
     */
    private String content;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 标签列表
     */
    private List<String> tagList;

    /**
     * 创建用户信息
     */
    private UserVO user;

    /**
     * 封装类转对象
     *
     * @param userCommentQstVO
     * @return
     */
    public static UserCommentQst voToObj(UserCommentQstVO userCommentQstVO) {
        if (userCommentQstVO == null) {
            return null;
        }
        UserCommentQst userCommentQst = new UserCommentQst();
        BeanUtils.copyProperties(userCommentQstVO, userCommentQst);
        List<String> tagList = userCommentQstVO.getTagList();
        return userCommentQst;
    }

    /**
     * 对象转封装类
     *
     * @param userCommentQst
     * @return
     */
    public static UserCommentQstVO objToVo(UserCommentQst userCommentQst) {
        if (userCommentQst == null) {
            return null;
        }
        UserCommentQstVO userCommentQstVO = new UserCommentQstVO();
        BeanUtils.copyProperties(userCommentQst, userCommentQstVO);
        return userCommentQstVO;
    }
}
